import request from '@/utils/request'

// 获取所有角色列表
export const getRoleList = (params) => request.get('/sys/role', { params })

/**
 * 获取公司信息
 * **/
export function getCompanyInfo(companyId) {
  return request({
    url: `/company/${companyId}`
  })
}
// 根据ID删除角色
export const delRoleList = (id) => request.delete('/sys/role/' + id)

// 根据ID更新角色
export const updateRole = (data) => request.put(`/sys/role/${data.id}`, data)

/**
 * 获取角色详情
 * **/
export function getRoleDetail(id) {
  return request({
    url: `/sys/role/${id}`
  })
}

// 添加角色
export const addRoleList = (data) => request.post('/sys/role/', data)

// 给角色分配权限 /sys/role/assignPrem
export const allotPermissions = (data) => request.put('/sys/role/assignPrem', data)

// 获取所有权限点  /sys/permission
export const getPermissions = () => request.get('/sys/permission')

// 根据ID获取角色详情 // /sys/role
export const getRoleDetails = (id) => request.get('/sys/role/' + id)

// 给角色分配权限
export function assignPerm(data) {
  return request({
    url: '/sys/role/assignPrem',
    method: 'put',
    data
  })
}
